refactor(libdd-telemetry)!: avoid leaking libdd-common types in the public API#2152
refactor(libdd-telemetry)!: avoid leaking libdd-common types in the public API#2152hoolioh wants to merge 2 commits into
Conversation
|
Clippy Allow Annotation ReportComparing clippy allow annotations between branches:
Summary by Rule
Annotation Counts by File
Annotation Stats by Crate
About This ReportThis report tracks Clippy allow annotations for specific rules, showing how they've changed in this PR. Decreasing the number of these annotations generally improves code quality. |
📚 Documentation Check Results📦
|
🔒 Cargo Deny Results📦
|
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-unknown-linux-gnu
|
276e7c6 to
2064bd2
Compare
2064bd2 to
d482c08
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d482c08f56
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
yannham
left a comment
There was a problem hiding this comment.
I initially thought you wanted to get rid of the libdd-common dependency for libdd-telemetry. But if I understand correctly, there's still a Endpoint lurking there internally, is that correct? Then I'm not sure I understand the motivation. Is it just to avoid having to add explicitly libdd-common for end-user crates just to import Endpoint? Then why not just re-export it from libdd-telemetry, if it's there anyway?
| url: ffi::CharSlice, | ||
| api_key: ffi::CharSlice, | ||
| timeout_ms: u64, | ||
| test_token: ffi::CharSlice, | ||
| use_system_resolver: bool, |
There was a problem hiding this comment.
The endpoint seems to carry quite a bit of different fields, that now have to be set manually one by one and inflate function arguments (there's a risk to forget about one field when setting the endpoint now instead of cfg.set_endpoint previously). I'm just thinking out loud, but would it make sense to re-introduce an Endpoint (or a different name) but stand-alone in libdd-telemetry that packs url, api_key, timeout_ms, together ? At least if we always want to set them all at once.
There was a problem hiding this comment.
I thought about that but I ended up adding more parameters here. However you have a point here, maybe taking the same approach as in TelemetryClientConfig would be better? WDYT?
The aim is to reduce the ways a crate can consume a type. If the consumer only uses telemetry it would be more than ok re-exporting the symbols through telemetry so there is only one source for them. Hoewever in our current situation we would be coupling telemetry to common and that will cascade into releasing major versions for multiple crates across the workspace. |
What does this PR do?
Break down endpoint settings into smaller functions which accept primitive types in order not to leak libdd-common types through the public API.
Motivation
Most of downstream projects don't use the Endpoint abstraction because it's thought to handle connections with intake/agent so forcing them to import libdd-common just to configure the connection doesn't seem right.